//package com.quartet.modules.equipment.controller;
//
//
//import cn.hutool.core.bean.BeanUtil;
//import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
//import com.baomidou.mybatisplus.core.metadata.IPage;
//import com.baomidou.mybatisplus.extension.api.ApiController;
//import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
//import com.quartet.api.ApiResult;
//import com.quartet.api.PageResult;
//import com.quartet.modules.equipment.dto.TRoadSpeedLimitRuleInfoAddRequestDto;
//import com.quartet.modules.equipment.dto.TRoadSpeedLimitRuleInfoQueryRequest;
//import com.quartet.modules.equipment.dto.TRoadSpeedLimitRuleInfoResponseDto;
//import com.quartet.modules.equipment.entity.TRoadSpeedLimitRuleInfo;
//import com.quartet.modules.equipment.service.TRoadSpeedLimitRuleInfoService;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.commons.lang3.StringUtils;
//import org.springframework.web.bind.annotation.*;
//
//import javax.annotation.Resource;
//import java.util.List;
//import java.util.stream.Collectors;
//
///**
// * 道路限速规则信息表(TRoadSpeedLimitRuleInfo)表控制层
// *
// * @author makejava
// * @since 2021-05-04 16:48:14
// */
//@RestController
//@RequestMapping("tRoadSpeedLimitRuleInfo")
//@Api(tags = "业务：道路限速规则信息")
//@Slf4j
//public class TRoadSpeedLimitRuleInfoController  {
//    /**
//     * 服务对象
//     */
//    @Resource
//    private TRoadSpeedLimitRuleInfoService tRoadSpeedLimitRuleInfoService;
//
//    /**
//     * 分页查询所有数据
//     *
//     * @param tRoadSpeedLimitRuleInfoQueryRequest 查询实体
//     * @return 所有数据
//     */
//    @ApiOperation("分页查询所有道路限速规则信息")
//    @PostMapping("/selectRoadSpeedLimitRulePage")
//    public ApiResult<PageResult<TRoadSpeedLimitRuleInfoResponseDto>> selectRoadSpeedLimitRulePage(@RequestBody TRoadSpeedLimitRuleInfoQueryRequest tRoadSpeedLimitRuleInfoQueryRequest) {
//        log.info("---------selectRoadSpeedLimitRulePage begin, tRoadSpeedLimitRuleInfoQueryRequest is {}----------", tRoadSpeedLimitRuleInfoQueryRequest);
//        IPage<TRoadSpeedLimitRuleInfo> page = new Page<>(tRoadSpeedLimitRuleInfoQueryRequest.getCurrent(), tRoadSpeedLimitRuleInfoQueryRequest.getLimit());
//        QueryWrapper<TRoadSpeedLimitRuleInfo> queryWrapper = new QueryWrapper<>();
//        if (!StringUtils.isNotBlank(tRoadSpeedLimitRuleInfoQueryRequest.getRoadSpeedLimitRuleName())) {
//            queryWrapper.lambda().like(TRoadSpeedLimitRuleInfo::getRoadSpeedLimitRuleName, tRoadSpeedLimitRuleInfoQueryRequest.getRoadSpeedLimitRuleName());
//        }
//        IPage<TRoadSpeedLimitRuleInfo> dbResult = tRoadSpeedLimitRuleInfoService.page(page, queryWrapper);
//        PageResult<TRoadSpeedLimitRuleInfoResponseDto> pageResult = new PageResult();
//        List<TRoadSpeedLimitRuleInfoResponseDto> tRoadSpeedLimitRuleInfoResponseDtoList = dbResult.getRecords().stream().map(tRoadSpeedLimitRuleInfo -> {
//            TRoadSpeedLimitRuleInfoResponseDto tRoadSpeedLimitRuleInfoResponseDto = BeanUtil.copyProperties(tRoadSpeedLimitRuleInfo, TRoadSpeedLimitRuleInfoResponseDto.class);
//            return tRoadSpeedLimitRuleInfoResponseDto;
//        }).collect(Collectors.toList());
//        pageResult.setTotal(dbResult.getTotal());
//        pageResult.setData(tRoadSpeedLimitRuleInfoResponseDtoList);
//        log.info("---------selectRoadSpeedLimitRulePage end, data is {}----------", pageResult);
//        return ApiResult.ok(pageResult);
//    }
//
//    /**
//     * 通过主键查询单条数据
//     *
//     * @param id 主键
//     * @return 单条数据
//     */
//    @ApiOperation("通过主键查询道路限速规则信息")
//    @GetMapping("/selectRoadSpeedLimitRuleById")
//    public ApiResult<TRoadSpeedLimitRuleInfoResponseDto> selectRoadSpeedLimitRuleById(@RequestParam("id") Integer id) {
//        log.info("---------selectRoadSpeedLimitRuleById begin, id is {}----------", id);
//        TRoadSpeedLimitRuleInfo tRoadSpeedLimitRuleInfo = tRoadSpeedLimitRuleInfoService.getById(id);
//        TRoadSpeedLimitRuleInfoResponseDto tRoadSpeedLimitRuleInfoResponseDto = BeanUtil.copyProperties(tRoadSpeedLimitRuleInfo, TRoadSpeedLimitRuleInfoResponseDto.class);
//        return ApiResult.ok(tRoadSpeedLimitRuleInfoResponseDto);
//    }
//
//    /**
//     * 新增数据
//     *
//     * @param tRoadSpeedLimitRuleInfoAddRequestDto 实体对象
//     * @return 新增结果
//     */
//    @ApiOperation("新增道路限速规则信息")
//    @PostMapping("/add")
//    public ApiResult addRoadSpeedLimitRule(@RequestBody TRoadSpeedLimitRuleInfoAddRequestDto tRoadSpeedLimitRuleInfoAddRequestDto) {
//        log.info("---------addRoadSpeedLimitRule begin, tRoadSpeedLimitRuleInfoAddRequestDto is {}----------", tRoadSpeedLimitRuleInfoAddRequestDto);
//        TRoadSpeedLimitRuleInfo tRoadSpeedLimitRuleInfo = BeanUtil.copyProperties(tRoadSpeedLimitRuleInfoAddRequestDto, TRoadSpeedLimitRuleInfo.class);
//        return ApiResult.ok(this.tRoadSpeedLimitRuleInfoService.save(tRoadSpeedLimitRuleInfo));
//    }
//
//    /**
//     * 修改数据
//     *
//     * @param tRoadSpeedLimitRuleInfoAddRequestDto 实体对象
//     * @return 修改结果
//     */
//    @ApiOperation("修改道路限速规则信息")
//    @PutMapping("/update")
//    public ApiResult updateRoadSpeedLimitRule(@RequestBody TRoadSpeedLimitRuleInfoAddRequestDto tRoadSpeedLimitRuleInfoAddRequestDto) {
//        log.info("---------updateRoadSpeedLimitRule begin, tRoadSpeedLimitRuleInfoAddRequestDto is {}----------", tRoadSpeedLimitRuleInfoAddRequestDto);
//        TRoadSpeedLimitRuleInfo tRoadSpeedLimitRuleInfo = BeanUtil.copyProperties(tRoadSpeedLimitRuleInfoAddRequestDto, TRoadSpeedLimitRuleInfo.class);
//        return ApiResult.ok(this.tRoadSpeedLimitRuleInfoService.updateById(tRoadSpeedLimitRuleInfo));
//    }
//
//    /**
//     * 删除数据
//     *
//     * @param id 主键
//     * @return 删除结果
//     */
//    @ApiOperation("删除道路限速规则信息")
//    @DeleteMapping("/delete")
//    public ApiResult delete(@RequestParam("id") Integer id) {
//        return ApiResult.ok(this.tRoadSpeedLimitRuleInfoService.removeById(id));
//    }
//}
